Returns the String form of the value passed.
Syntax |
|---|
|
result = Str( number ) |
Parameters |
||
|---|---|---|
|
number |
Any |
Any numeric expression. |
Return Value |
||
|---|---|---|
|
Result |
The String version of the number passed. |
|
Notes
Use the Format function when you want to convert numeric values into formatted strings such as dates, times, currency, etc. For real numbers, Str returns 7 significant digits.
Str assumes the period (.) is the decimal separator. If your application needs to recognize other decimal separators, use the CStr function.
Examples
This example uses the Str function to return the String form of several numbers.
Dim s As String
s=Str(123) //returns "123"
s=Str(-123.44) //returns "-123.44"
s=Str(123.0045) //returns "123.0045"
Const Pi=3.14159265358979323846264338327950
s= Str(pi) // returns "3.141593"
s= Str(3141592653589012345) // returns "3141592653589012345"
s=Str(123) //returns "123"
s=Str(-123.44) //returns "-123.44"
s=Str(123.0045) //returns "123.0045"
Const Pi=3.14159265358979323846264338327950
s= Str(pi) // returns "3.141593"
s= Str(3141592653589012345) // returns "3141592653589012345"